#encoding=utf-8
#导入Driver方法
from Driver import *
class Elements():
    """封装元素方法
    """
    # def __init__(self):
        # t=AppiumTest()
        # self.driver=t.get_driver()

    def get_id(self,id,driver):
        try:
            element = driver.find_element_by_id(id)
            return element
        except Exception as e:
            print("未找到id为%s元素"%(id))

    def get_name(self,name,driver):
        try:
            element=driver.find_element_by_name(name)
            return element
        except Exception as e:
            print("未找到name为%s的元素"%(name))

    def get_xpath(self,xpath,driver):
        try:
            element = driver.find_element_by_xpath(xpath)
            return element
        except Exception as e:
            print("未找到xpath为%s元素"%(xpath))





